package com.gitee.swsk33.websockethandlerdemo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;

/**
 * 配置WebSocket服务端配置
 */
@Configuration
public class WebSocketServerConfig {

	@Bean
	public ServletServerContainerFactoryBean createWebSocketContainer() {
		ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
		// 设定文本消息最大接收大小（单位：字节）
		container.setMaxTextMessageBufferSize(10240);
		// 设定二进制消息最大接收大小（单位：字节）
		container.setMaxBinaryMessageBufferSize(10240);
		return container;
	}

}